3.1.29 \(\int \csc ^4(c+d x) (a+b \tan (c+d x))^2 \, dx\) [29]

Optimal. Leaf size=79 \[ -\frac {\left (a^2+b^2\right ) \cot (c+d x)}{d}-\frac {a b \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}+\frac {2 a b \log (\tan (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \]

[Out]

-(a^2+b^2)*cot(d*x+c)/d-a*b*cot(d*x+c)^2/d-1/3*a^2*cot(d*x+c)^3/d+2*a*b*ln(tan(d*x+c))/d+b^2*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 79, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {3597, 908} \begin {gather*} -\frac {\left (a^2+b^2\right ) \cot (c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {a b \cot ^2(c+d x)}{d}+\frac {2 a b \log (\tan (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Csc[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

-(((a^2 + b^2)*Cot[c + d*x])/d) - (a*b*Cot[c + d*x]^2)/d - (a^2*Cot[c + d*x]^3)/(3*d) + (2*a*b*Log[Tan[c + d*x
]])/d + (b^2*Tan[c + d*x])/d

Rule 908

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIn
tegrand[(d + e*x)^m*(f + g*x)^n*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[e*f - d*g, 0] &&
NeQ[c*d^2 + a*e^2, 0] && IntegerQ[p] && ((EqQ[p, 1] && IntegersQ[m, n]) || (ILtQ[m, 0] && ILtQ[n, 0]))

Rule 3597

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[b/f, Subst[Int
[x^m*((a + x)^n/(b^2 + x^2)^(m/2 + 1)), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[m/
2]

Rubi steps

\begin {align*} \int \csc ^4(c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac {b \text {Subst}\left (\int \frac {(a+x)^2 \left (b^2+x^2\right )}{x^4} \, dx,x,b \tan (c+d x)\right )}{d}\\ &=\frac {b \text {Subst}\left (\int \left (1+\frac {a^2 b^2}{x^4}+\frac {2 a b^2}{x^3}+\frac {a^2+b^2}{x^2}+\frac {2 a}{x}\right ) \, dx,x,b \tan (c+d x)\right )}{d}\\ &=-\frac {\left (a^2+b^2\right ) \cot (c+d x)}{d}-\frac {a b \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}+\frac {2 a b \log (\tan (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 1.51, size = 127, normalized size = 1.61 \begin {gather*} -\frac {\left (3 a b \cot ^2(c+d x)+a^2 \cot ^3(c+d x)+\cos ^2(c+d x) \left (\left (2 a^2+3 b^2\right ) \cot (c+d x)+6 a b (\log (\cos (c+d x))-\log (\sin (c+d x)))\right )-\frac {3}{2} b^2 \sin (2 (c+d x))\right ) (a+b \tan (c+d x))^2}{3 d (a \cos (c+d x)+b \sin (c+d x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Csc[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

-1/3*((3*a*b*Cot[c + d*x]^2 + a^2*Cot[c + d*x]^3 + Cos[c + d*x]^2*((2*a^2 + 3*b^2)*Cot[c + d*x] + 6*a*b*(Log[C
os[c + d*x]] - Log[Sin[c + d*x]])) - (3*b^2*Sin[2*(c + d*x)])/2)*(a + b*Tan[c + d*x])^2)/(d*(a*Cos[c + d*x] +
b*Sin[c + d*x])^2)

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 80, normalized size = 1.01

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {2}{3}-\frac {\left (\csc ^{2}\left (d x +c \right )\right )}{3}\right ) \cot \left (d x +c \right )+2 a b \left (-\frac {1}{2 \sin \left (d x +c \right )^{2}}+\ln \left (\tan \left (d x +c \right )\right )\right )+b^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) \(80\)
default \(\frac {a^{2} \left (-\frac {2}{3}-\frac {\left (\csc ^{2}\left (d x +c \right )\right )}{3}\right ) \cot \left (d x +c \right )+2 a b \left (-\frac {1}{2 \sin \left (d x +c \right )^{2}}+\ln \left (\tan \left (d x +c \right )\right )\right )+b^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) \(80\)
risch \(\frac {4 a b \,{\mathrm e}^{6 i \left (d x +c \right )}+4 i a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-4 i b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+\frac {8 i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{3}+8 i b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-4 a b \,{\mathrm e}^{2 i \left (d x +c \right )}-\frac {4 i a^{2}}{3}-4 i b^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}+\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}-\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(170\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(d*x+c)^4*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*(-2/3-1/3*csc(d*x+c)^2)*cot(d*x+c)+2*a*b*(-1/2/sin(d*x+c)^2+ln(tan(d*x+c)))+b^2*(1/sin(d*x+c)/cos(d*x
+c)-2*cot(d*x+c)))

________________________________________________________________________________________

Maxima [A]
time = 0.35, size = 69, normalized size = 0.87 \begin {gather*} \frac {6 \, a b \log \left (\tan \left (d x + c\right )\right ) + 3 \, b^{2} \tan \left (d x + c\right ) - \frac {3 \, a b \tan \left (d x + c\right ) + 3 \, {\left (a^{2} + b^{2}\right )} \tan \left (d x + c\right )^{2} + a^{2}}{\tan \left (d x + c\right )^{3}}}{3 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/3*(6*a*b*log(tan(d*x + c)) + 3*b^2*tan(d*x + c) - (3*a*b*tan(d*x + c) + 3*(a^2 + b^2)*tan(d*x + c)^2 + a^2)/
tan(d*x + c)^3)/d

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 174 vs. \(2 (77) = 154\).
time = 0.36, size = 174, normalized size = 2.20 \begin {gather*} -\frac {2 \, {\left (a^{2} + 3 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 3 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) - 3 \, {\left (a^{2} + 3 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (\cos \left (d x + c\right )^{2}\right ) \sin \left (d x + c\right ) - 3 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{4} \, \cos \left (d x + c\right )^{2} + \frac {1}{4}\right ) \sin \left (d x + c\right ) + 3 \, b^{2}}{3 \, {\left (d \cos \left (d x + c\right )^{3} - d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/3*(2*(a^2 + 3*b^2)*cos(d*x + c)^4 - 3*a*b*cos(d*x + c)*sin(d*x + c) - 3*(a^2 + 3*b^2)*cos(d*x + c)^2 + 3*(a
*b*cos(d*x + c)^3 - a*b*cos(d*x + c))*log(cos(d*x + c)^2)*sin(d*x + c) - 3*(a*b*cos(d*x + c)^3 - a*b*cos(d*x +
 c))*log(-1/4*cos(d*x + c)^2 + 1/4)*sin(d*x + c) + 3*b^2)/((d*cos(d*x + c)^3 - d*cos(d*x + c))*sin(d*x + c))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \csc ^{4}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)**4*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*csc(c + d*x)**4, x)

________________________________________________________________________________________

Giac [A]
time = 0.59, size = 91, normalized size = 1.15 \begin {gather*} \frac {6 \, a b \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) + 3 \, b^{2} \tan \left (d x + c\right ) - \frac {11 \, a b \tan \left (d x + c\right )^{3} + 3 \, a^{2} \tan \left (d x + c\right )^{2} + 3 \, b^{2} \tan \left (d x + c\right )^{2} + 3 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{3}}}{3 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/3*(6*a*b*log(abs(tan(d*x + c))) + 3*b^2*tan(d*x + c) - (11*a*b*tan(d*x + c)^3 + 3*a^2*tan(d*x + c)^2 + 3*b^2
*tan(d*x + c)^2 + 3*a*b*tan(d*x + c) + a^2)/tan(d*x + c)^3)/d

________________________________________________________________________________________

Mupad [B]
time = 3.79, size = 72, normalized size = 0.91 \begin {gather*} \frac {b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (a^2+b^2\right )+\frac {a^2}{3}+a\,b\,\mathrm {tan}\left (c+d\,x\right )}{d\,{\mathrm {tan}\left (c+d\,x\right )}^3}+\frac {2\,a\,b\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tan(c + d*x))^2/sin(c + d*x)^4,x)

[Out]

(b^2*tan(c + d*x))/d - (tan(c + d*x)^2*(a^2 + b^2) + a^2/3 + a*b*tan(c + d*x))/(d*tan(c + d*x)^3) + (2*a*b*log
(tan(c + d*x)))/d

________________________________________________________________________________________